Signals are broadcast messages. They carry input parameters, which are received by all objects which have registered for such a signal.
This function is similar to
dbus-call-method. The difference is, that there are no returning output parameters.The function emits signal on the D-Bus bus. bus is either the symbol
:systemor the symbol:session. It doesn't matter whether another object has registered for signal.service is the D-Bus service name of the object the signal is emitted from. path is the corresponding D-Bus object path, service is registered at. interface is an interface offered by service. It must provide signal.
All other arguments args are passed to signal as arguments. They are converted into D-Bus types as described in Type Conversion. Example:
(dbus-send-signal :session dbus-service-emacs dbus-path-emacs (concat dbus-service-emacs ".FileManager") "FileModified" "/home/albinus/.emacs")
With this function, an application registers for signal on the D-Bus bus.
bus is either the symbol
:systemor the symbol:session.service is the D-Bus service name used by the sending D-Bus object. It can be either a known name or the unique name of the D-Bus object sending the signal. In case of a unique name, signals won't be received any longer once the object owning this unique name has disappeared, and a new queued object has replaced it.
When service is
nil, related signals from all D-Bus objects shall be accepted.path is the corresponding D-Bus object path, service is registered at. It can also be
nilif the path name of incoming signals shall not be checked.interface is an interface offered by service. It must provide signal.
handler is a Lisp function to be called when the signal is received. It must accept as arguments the output parameters signal is sending.
All other arguments args, if specified, must be strings. They stand for the respective arguments of signal in their order, and are used for filtering as well. A
nilargument might be used to preserve the order.
dbus-register-signalreturns a Lisp object, which can be used as argument indbus-unregister-objectfor removing the registration for signal. Example:(defun my-dbus-signal-handler (device) (message "Device %s added" device)) ⇒ my-dbus-signal-handler (dbus-register-signal :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" "org.freedesktop.Hal.Manager" "DeviceAdded" 'my-dbus-signal-handler) ⇒ ((:system "org.freedesktop.Hal.Manager" "DeviceAdded") ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" my-signal-handler))As we know from the introspection data of interface ‘org.freedesktop.Hal.Manager’, the signal ‘DeviceAdded’ provides one single parameter, which is mapped into a Lisp string. The callback function
my-dbus-signal-handlermust define one single string argument therefore. Plugging an USB device to your machine, when registered for signal ‘DeviceAdded’, will show you which objects the GNU/Linuxhaldaemon adds.